<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>

    <script>
        //ES6 中变量声明的语法

        //let  const

        //1. let和const都有块级作用域
        //2. let和const声明变量不能重名
        //3. const声明的是常量，这个常量只能在声明的时候赋值，声明之后赋值会报错！！



        // let a = 10;
        // console.log(a);


        // {
        //     const a = 10;
        // }

        // console.log(a);

        // const a = 10;
        // const a = 100;
        // console.log(a);


        const a = 10;
        a = 100;
        console.log(a);



        for(var i = 0; i < 10; i++){
            setTimeout(function(){
                console.log(i);
            }, 0)
        }
        
        console.log("ok");
    </script>

</body>

</html>